package com.wlyuan.open.scanner.domain.finance;

import com.wlyuan.open.scanner.dao.entity.BalanceBillDetailsDO;
import com.wlyuan.open.scanner.utils.mappings.MappingInvalid;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author lijing
 * @description
 */
public class BillSpecConvert {

    private static final Convert CONVERT = Mappers.getMapper(Convert.class);

    @Mapper(uses = MappingInvalid.class)
    public interface Convert {

        @Mappings({
                @Mapping(target = "transportId", source = "detailOrderid"),
                @Mapping(target = "contractNo", source = "detailPactcode"),
                @Mapping(target = "problemDesc", source = "detailExcreason"),
        })
        BillSpec convert(BalanceBillDetailsDO source);

        List<BillSpec> convert(List<BalanceBillDetailsDO> list);

    }

    public static List<BillSpec> convert(List<BalanceBillDetailsDO> creation) {
        return CONVERT.convert(creation);
    }

    public static BillSpec convert(BalanceBillDetailsDO source) {
        return CONVERT.convert(source);
    }
}
